<template>
  <div
    class="tip"
    @click="clickOutside"
    :style="{ visibility: isShowTip ? 'visible' : 'hidden', opacity: isShowTip ? 1 : 0 }"
  >
    <div class="info" ref="info">
      <h2>关于:</h2>
      <p class="p">这个应用可以用来追踪你选择城市的当前天气</p>
      <h2>如何使用:</h2>
      <p>1.点击搜索框输入你希望追踪的城市</p>
      <p>2.在搜索结果中选中一个城市，你将获取当地最新的天气</p>
      <p class="p">3.点击右侧的＋号可以将追踪城市的天气情况保存在首页</p>
      <h2>移除城市:</h2>
      <p>如果你不想在首页关注某个城市,可以通过底部的按钮删除它</p>
      <button @click="clickCloseTip">关闭</button>
    </div>
  </div>
</template>

<script setup>
import { storeToRefs } from 'pinia'
import { useWeatherStore } from '@/stores/weather'
const { isShowTip,info } = storeToRefs(useWeatherStore())
const { clickCloseTip, clickOutside } = useWeatherStore()
</script>

<style lang="scss" scoped>
.tip {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: 100vw;
  transition: all 1s;
  background-color: rgba(0 0 0 / 0.5);
  z-index: 11;
  .info {
    margin: 150px auto;
    width: 330px;
    background-color: #fff;
    padding: 16px;
    z-index: 999;
    h2 {
      font-size: inherit;
      font-weight: inherit;
    }
    p {
      font-size: 0.75rem;
      line-height: 1rem;
    }
    .p {
      margin-bottom: 16px;
    }
    button {
      width: 76px;
      height: 34px;
      font-size: 0.75rem;
      color: #fff;
      background-color: rgb(0, 102, 138);
      margin-top: 32px;
      padding: 8px 24px;
      cursor: pointer;
    }
  }
}</style>
